package IO;

import java.io.*;

//打印流
public class PrintFile {
    public static void main(String[] args) {
       printchar();
    }
    public static void printbyte(){//字节打印流
        File file = new File("C:\\Users\\Administrator\\Desktop\\File\\1207.txt");
        try {
            OutputStream out = new FileOutputStream(file);
            //加缓存
            BufferedOutputStream bf = new BufferedOutputStream(out);
            //增强打印功能
            PrintStream PS = new PrintStream(bf);
            PS.println("小河流水到我家，天天");
            PS.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }
    public static void printchar(){
        File file = new File("C:\\Users\\Administrator\\Desktop\\File\\1207.txt");
        try {
            Writer writer = new FileWriter(file);
            //加缓存
            BufferedWriter bw = new BufferedWriter(writer);
            //字符打印流
            PrintWriter pw = new PrintWriter(bw);
            pw.println("小红老师啦啦啦");
            pw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}
